<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta http-equiv="X-UA-Compatible" content="ie=edge" />
    <title>DEMO 预览</title>
    <style>
      body {
        font-family: PingFangSC-Regular, Roboto, Helvetica Neue, Helvetica, Tahoma, Arial,
          PingFang SC-Light, Microsoft YaHei;
        font-size: 12px;

        * {
          box-sizing: border-box;
        }
      }

      body,
      #lce-container {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        top: 0;
        box-sizing: border-box;
        padding: 0;
        margin: 0;
        overflow: hidden;
        text-rendering: optimizeLegibility;
        -webkit-user-select: none;
        -webkit-user-drag: none;
        -webkit-text-size-adjust: none;
        -webkit-touch-callout: none;
        -webkit-font-smoothing: antialiased;
      }

      html {
        min-width: 1024px;
      }
    </style>
  </head>

  <body>
    <link rel="stylesheet" href="https://uipaas-assets.com/prod/npm/@alilc/lowcode-engine/1.1.7-beta.11/dist/css/engine-core.css" />
    <link rel="stylesheet" href="https://uipaas-assets.com/prod/npm/@alilc/lowcode-engine-ext/1.0.6-beta.25/dist/css/engine-ext.css" />
    <link rel="stylesheet" href="https://alifd.alicdn.com/npm/@alilc/lowcode-preset-plugin@0.1.2/dist/lowcode-preset-plugin.css" />
    <link href="https://alifd.alicdn.com/npm/@alifd/theme-lowcode-light@0.2.1/variables.css" rel="stylesheet" />
    <link href="https://alifd.alicdn.com/npm/@alifd/theme-lowcode-light@0.2.1/dist/next.var.min.css" rel="stylesheet" />
    
    <div id="lce-container"></div>
    <script src="https://g.alicdn.com/code/lib/rax/1.1.0/rax.umd.min.js"></script>
    <script src="https://g.alicdn.com/code/lib/react/16.9.0/umd/react.development.js"></script>
    <script src="https://g.alicdn.com/code/lib/react-dom/16.9.0/umd/react-dom.development.js"></script>
    <script src="https://g.alicdn.com/code/lib/prop-types/15.7.2/prop-types.js"></script>
    <script>
      React.PropTypes = PropTypes;
    </script>
    <script src="https://g.alicdn.com/platform/c/??react15-polyfill/0.0.1/dist/index.js,lodash/4.6.1/lodash.min.js,immutable/3.7.6/dist/immutable.min.js,natty-storage/2.0.2/dist/natty-storage.min.js,natty-fetch/2.6.0/dist/natty-fetch.pc.min.js,tinymce/4.2.5/tinymce-full.js"></script>
    <script src="https://g.alicdn.com/mylib/moment/2.24.0/min/moment.min.js"></script>
    <script src="https://g.alicdn.com/code/lib/alifd__next/1.23.20/next-with-locales.min.js"></script>
    
    <script crossorigin="anonymous" src="https://uipaas-assets.com/prod/npm/@alilc/lowcode-engine/1.1.7-beta.11/dist/js/engine-core.js"></script>
    <script crossorigin="anonymous" src="https://uipaas-assets.com/prod/npm/@alilc/lowcode-engine-ext/1.0.6-beta.25/dist/js/engine-ext.js"></script>
    <script>
      if (!window.AliLowCodeEngine.common) {
        window.AliLowCodeEngine.common = {
          designerCabin: window.AliLowCodeEngine.designerCabin,
          editorCabin: window.AliLowCodeEngine.editorCabin,
          skeletonCabin: window.AliLowCodeEngine.skeletonCabin,
          utils: window.AliLowCodeEngine.utils,
        };
      }
    </script>
    <script src="https://alifd.alicdn.com/npm/@alilc/lowcode-preset-plugin@0.1.2/dist/lowcode-preset-plugin.js"></script>
    <script type="text/javascript" charset="utf-8" src="./index.js"></script>
    <script>
      (function (factory) {
        if (typeof define === 'function' && define.amd) {
          define([], factory);
        } else if (typeof module === 'object' && module.exports) {
          module.exports = factory();
        } else {
          window.idleCallbackShim = factory();
        }
      })(function () {
        'use strict';
        var scheduleStart, throttleDelay, lazytimer, lazyraf;
        var root =
          typeof window != 'undefined' ? window : typeof global != undefined ? global : this || {};
        var requestAnimationFrame =
          (root.cancelRequestAnimationFrame && root.requestAnimationFrame) || setTimeout;
        var cancelRequestAnimationFrame = root.cancelRequestAnimationFrame || clearTimeout;
        var tasks = [];
        var runAttempts = 0;
        var isRunning = false;
        var remainingTime = 7;
        var minThrottle = 35;
        var throttle = 125;
        var index = 0;
        var taskStart = 0;
        var tasklength = 0;
        var IdleDeadline = {
          get didTimeout() {
            return false;
          },
          timeRemaining: function () {
            var timeRemaining = remainingTime - (Date.now() - taskStart);
            return Math.max(0, timeRemaining);
          },
        };
        var setInactive = debounce(function () {
          remainingTime = 22;
          throttle = 66;
          minThrottle = 0;
        });

        function debounce(fn) {
          var id, timestamp;
          var wait = 99;
          var check = function () {
            var last = Date.now() - timestamp;

            if (last < wait) {
              id = setTimeout(check, wait - last);
            } else {
              id = null;
              fn();
            }
          };
          return function () {
            timestamp = Date.now();
            if (!id) {
              id = setTimeout(check, wait);
            }
          };
        }

        function abortRunning() {
          if (isRunning) {
            if (lazyraf) {
              cancelRequestAnimationFrame(lazyraf);
            }
            if (lazytimer) {
              clearTimeout(lazytimer);
            }
            isRunning = false;
          }
        }

        function onInputorMutation() {
          if (throttle != 125) {
            remainingTime = 7;
            throttle = 125;
            minThrottle = 35;

            if (isRunning) {
              abortRunning();
              scheduleLazy();
            }
          }
          setInactive();
        }

        function scheduleAfterRaf() {
          lazyraf = null;
          lazytimer = setTimeout(runTasks, 0);
        }

        function scheduleRaf() {
          lazytimer = null;
          requestAnimationFrame(scheduleAfterRaf);
        }

        function scheduleLazy() {
          if (isRunning) {
            return;
          }
          throttleDelay = throttle - (Date.now() - taskStart);

          scheduleStart = Date.now();

          isRunning = true;

          if (minThrottle && throttleDelay < minThrottle) {
            throttleDelay = minThrottle;
          }

          if (throttleDelay > 9) {
            lazytimer = setTimeout(scheduleRaf, throttleDelay);
          } else {
            throttleDelay = 0;
            scheduleRaf();
          }
        }

        function runTasks() {
          var task, i, len;
          var timeThreshold = remainingTime > 9 ? 9 : 1;
          taskStart = Date.now();
          isRunning = false;

          lazytimer = null;

          if (runAttempts > 2 || taskStart - throttleDelay - 50 < scheduleStart) {
            for (
              i = 0, len = tasks.length;
              i < len && IdleDeadline.timeRemaining() > timeThreshold;
              i++
            ) {
              task = tasks.shift();
              tasklength++;
              if (task) {
                task(IdleDeadline);
              }
            }
          }

          if (tasks.length) {
            scheduleLazy();
          } else {
            runAttempts = 0;
          }
        }

        function requestIdleCallbackShim(task) {
          index++;
          tasks.push(task);
          scheduleLazy();
          return index;
        }

        function cancelIdleCallbackShim(id) {
          var index = id - 1 - tasklength;
          if (tasks[index]) {
            tasks[index] = null;
          }
        }

        if (!root.requestIdleCallback || !root.cancelIdleCallback) {
          root.requestIdleCallback = requestIdleCallbackShim;
          root.cancelIdleCallback = cancelIdleCallbackShim;

          if (root.document && document.addEventListener) {
            root.addEventListener('scroll', onInputorMutation, true);
            root.addEventListener('resize', onInputorMutation);

            document.addEventListener('focus', onInputorMutation, true);
            document.addEventListener('mouseover', onInputorMutation, true);
            ['click', 'keypress', 'touchstart', 'mousedown'].forEach(function (name) {
              document.addEventListener(name, onInputorMutation, { capture: true, passive: true });
            });

            if (root.MutationObserver) {
              new MutationObserver(onInputorMutation).observe(document.documentElement, {
                childList: true,
                subtree: true,
                attributes: true,
              });
            }
          }
        } else {
          try {
            root.requestIdleCallback(function () {}, { timeout: 0 });
          } catch (e) {
            (function (rIC) {
              var timeRemainingProto, timeRemaining;
              root.requestIdleCallback = function (fn, timeout) {
                if (timeout && typeof timeout.timeout == 'number') {
                  return rIC(fn, timeout.timeout);
                }
                return rIC(fn);
              };
              if (
                root.IdleCallbackDeadline &&
                (timeRemainingProto = IdleCallbackDeadline.prototype)
              ) {
                timeRemaining = Object.getOwnPropertyDescriptor(
                  timeRemainingProto,
                  'timeRemaining',
                );
                if (!timeRemaining || !timeRemaining.configurable || !timeRemaining.get) {
                  return;
                }
                Object.defineProperty(timeRemainingProto, 'timeRemaining', {
                  value: function () {
                    return timeRemaining.get.call(this);
                  },
                  enumerable: true,
                  configurable: true,
                });
              }
            })(root.requestIdleCallback);
          }
        }

        return {
          request: requestIdleCallbackShim,
          cancel: cancelIdleCallbackShim,
        };
      });
    </script>
  </body>
</html>
